Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for custom method qualifiers #11

Merged
merged 1 commit into from
Aug 14, 2023

Conversation

Darhazer
Copy link
Contributor

Fixes #10

@shanecav84
Copy link
Owner

Thanks for this and #12! I'll make time to get them merged this week.

def ordered?(left_method, right_method)
comparison = COMPARISONS[cop_config['EnforcedStyle']]
raise Error, ERR_INVALID_COMPARISON if comparison.nil?

comparison.call(left_method, right_method)
end

def relevant_node?(node)
(node.defs_type? || node.def_type?) && !ignored_method?(node.method_name)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to use the extracted .method_name to get the node's method name here and on line 153?

Copy link
Contributor Author

@Darhazer Darhazer Aug 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really necessary, since it first check that the node is either def or defs, and the method_name handles send nodes, in order to get the defined method name, and not the name of the macro (e.g. get foo and not memoize in case of memoize def foo.
Though since it will return the same (node.method_name) for a node that is not of a send type, I can call it. I'd rather keep it as is, as method_name is defined on the class level

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. Thanks!

@shanecav84 shanecav84 merged commit 8bea714 into shanecav84:master Aug 14, 2023
@shanecav84
Copy link
Owner

This has been released in 0.10. Thanks again!

@Darhazer Darhazer deleted the allow-memoization-dsl branch August 14, 2023 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OrderedMethods do not work with custom DSLs
2 participants